package org.dlsu.mt;

import java.util.StringTokenizer;

/**
 * Tokenizes the document using the next line character using StringTokenizer
 */
public class SimpleSentenceTokenizer implements SentenceTokenizerInterface {
	/**
	 * String tokenizer used to tokenize the document
	 */
	protected StringTokenizer st=null;

	/**
	 * Sets the document to tokenize
	 *
	 * @param text String document to tokenize
	 */
	public void setDocument(Object text) {
		st = new StringTokenizer((String) text,".");
	}

	/**
	 * Gets the next sentence tokenized
	 *
	 * @return Next sentence from the document
	 */
	public Object nextSentence() {
		if (st == null)
			throw new RuntimeException("No Document Set");
		return st.nextToken();
	}

	/**
	 * Checks if there are more sentences
	 *
	 * @return true if there are more sentences remaining, false otherwise
	 */
	public boolean hasMoreSentences() {
		return st.hasMoreTokens();
	}
}